]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
tools/create-toolbox: Allow enabling additional locales
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 20 Mar 2023 20:21:36 +0000 (21:21 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 16 May 2023 18:20:42 +0000 (18:20 +0000)
Out of the box, the container images only support US English. It
can sometimes be necessary to use a different locale, so add
a convenience flag to enable support for additional locales.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2713>

tools/toolbox/create-toolbox.sh

index 4002901037d8f2e0d0142581507a367ab90c3fb3..c63c49e56de3773a09accbd36210ce6fcde69a59 100755 (executable)
@@ -19,6 +19,7 @@ usage() {
                                  (like 44) instead of the main branch
          -r, --replace           Replace an existing container
          -b, --builder           Set up GNOME Builder configuration
+         --locales=LOCALES       Enable support for additional locales LOCALES
          --skip-mutter           Do not build mutter
          -h, --help              Display this help
 
@@ -34,6 +35,16 @@ toolbox_run() {
   toolbox run --container $NAME "$@"
 }
 
+install_extra_packages() {
+  local -a pkgs
+
+  pkgs+=( ${LOCALES[@]/#/glibc-langpack-} )
+
+  [[ ${#pkgs[@]} > 0 ]] &&
+    toolbox_run su -c "dnf install -y ${pkgs[*]}"
+  true
+}
+
 create_builder_config() {
   local container_id=$(podman container inspect --format='{{.Id}}' $NAME)
   local top_srcdir=$(realpath $(dirname $0)/../..)
@@ -61,6 +72,7 @@ TEMP=$(getopt \
   --longoptions 'version:' \
   --longoptions 'replace' \
   --longoptions 'builder' \
+  --longoptions 'locales:' \
   --longoptions 'skip-mutter' \
   --longoptions 'help' \
   -- "$@")
@@ -69,6 +81,7 @@ eval set -- "$TEMP"
 unset TEMP
 
 NAME=$DEFAULT_NAME
+LOCALES=()
 
 while true; do
   case "$1" in
@@ -97,6 +110,11 @@ while true; do
       shift
     ;;
 
+    --locales)
+      IFS=" ," LOCALES+=($2)
+      shift 2
+    ;;
+
     -h|--help)
       usage
       exit 0
@@ -120,6 +138,8 @@ fi
 podman pull $TOOLBOX_IMAGE:$TAG
 
 toolbox create --image $TOOLBOX_IMAGE:$TAG $NAME
+install_extra_packages
+
 [[ $SKIP_MUTTER ]] || toolbox_run update-mutter
 
 [[ $SETUP_BUILDER ]] && create_builder_config